type Cell = 'empty'|'hit'|'miss', cells: Cell[][].<Board/>, <Cell/>, <Status/>. Don't over-split.(state, onClick), nothing else.cells.map((row,r) => row.map((cell,c) => ...)) inside display:grid. Stable keys (`${r}-${c}` is fine for a fixed grid).useMemo, then display it.value + onChange together, always.// @ts-nocheck if TS squiggles distract you.// the immutable 2D update โ know this cold
setCells(prev => prev.map((row, ri) =>
ri !== r ? row
: row.map((cell, ci) => ci !== c ? cell : nextState(cell))
));
Map from cell โ ship makes it O(1) per click if n grows."React.memo and stabilize onClick with useCallback." Only implement if asked.// @ts-nocheck on line 1 silences them.